// 云函数入口文件
const cloud = require('wx-server-sdk')
const { eventBridge } = require('XrFrame/kanata/lib/index')

cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境
const db = cloud.database()
const _ = db.command
// 云函数入口函数
exports.main = async (event, context) => {
  try{
    return await db.collection('tasks').add({
        data:{
          name:event.name,
          icon:event.icon,
          logs:event.logs,
          days:event.days,
          time:event.time
        },
        success:res=>{
         console.log(res)
        },
        fail:err=>{
            console.error(err)
        }
    })
}catch(e){
    console.log(e)
}
}